package com.gengine.resource.loader
{
	import flash.utils.*;
	
	public class XMLLoader extends BaseLoader
	{
		private var _valid:Boolean = true;
		private var _xml:XML = null;
		
		public function XMLLoader()
		{
			
		}
		
		public function get XMLData() : XML
		{
			return this._xml;
		}
		
		override public function getClass() : Class
		{
			return XMLLoader;
		}
		
		override public function initialize(param1:*) : void
		{
			var data:* = param1;
			if (!(data is ByteArray))
			{
				throw new Error("XMLResource can only initialize from ByteArrays.");
			}
			try
			{
				this._xml = new XML(data.toString());
				if (resourceInfo)
				{
					resourceInfo.data = this._xml;
				}
			}
			catch (e:TypeError)
			{
				_valid = false;
			}
			onLoadCompleteHandler();
			
		}
		
		override protected function onContentReady(param1:*) : Boolean
		{
			return this._valid;
		}
		
	}
}
